package com.googlecode.nls4j.benchmarks.en;

import java.util.Locale;
import java.util.ResourceBundle;

public class Benchmark {

    public static void main(final String[] args) throws Exception {
        Locale.setDefault(Locale.ENGLISH);
        final int iters = 100000000;
        final ResourceBundle rb = ResourceBundle.getBundle(Msg.class.getName());
        String msg = null;

        long time = System.currentTimeMillis();
        for (int i = 0; i < iters; i++) {
            msg = (String) rb.getObject("M1");
        }
        System.out.println("java.util.ResourceBundle: "
                + (System.currentTimeMillis() - time));

        time = System.currentTimeMillis();
        for (int i = 0; i < iters; i++) {
            msg = Msg.M1.toString();
        }
        System.out.println("toString() with EnumBundle: "
                + (System.currentTimeMillis() - time));

        System.out.println(msg);
    }
}
